Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Test Anything Protocol</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Test_Anything_Protocol"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Test_Anything_Protocol rootpage-Test_Anything_Protocol skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Test Anything Protocol</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">For the network tunnel driver, see <a href="TUN/TAP" title="TUN/TAP">TUN/TAP</a>.</div>
<style data-mw-deduplicate="TemplateStyles:r1251242444">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style>
<p>The <b>Test Anything Protocol</b> (<b>TAP</b>) is a protocol for communicating between <a href="Automated_testing" class="mw-redirect" title="Automated testing">test logic</a>, called a TAP producer, and a <a href="Test_harness" title="Test harness">test harness</a> in a <a href="Language-independent_specification" title="Language-independent specification">language-agnostic</a> way. Originally developed for <a href="Unit_testing" title="Unit testing">unit testing</a> of the <a href="Perl" title="Perl">Perl</a> interpreter in 1987, producers and parsers are now available for many development platforms.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>TAP was created for the first version of the <a href="Perl_programming_language" class="mw-redirect" title="Perl programming language">Perl programming language</a> (released in 1987), as part of Perl's core <a href="Test_harness" title="Test harness">test harness</a> (<samp style="padding-left:0.4em; padding-right:0.4em; color:var( --color-subtle, #666666);">t/TEST</samp>). The <code>Test::Harness</code> <a href="Perl_module" title="Perl module">module</a> was written by Tim Bunce and Andreas König to allow Perl module authors to take advantage of TAP. It became the <i>de facto</i> standard for Perl testing.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p><p>Development of TAP, including standardization of the protocol, writing of test producers and consumers, and evangelizing the language is coordinated at the TestAnything website.<sup id="cite_ref-TestAnything.org_4-0" class="reference"><a href="#cite_note-TestAnything.org-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>As a protocol which is agnostic of programming language, TAP unit testing libraries expanded beyond their Perl roots and have been developed for various languages and systems such as <a href="PostgreSQL" title="PostgreSQL">PostgreSQL</a>,<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> <a href="MySQL" title="MySQL">MySQL</a>,<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> <a href="JavaScript" title="JavaScript">JavaScript</a><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> and other implementations listed on the project site.<sup id="cite_ref-TestAnything.org_4-1" class="reference"><a href="#cite_note-TestAnything.org-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> A TAP <a href="Software_library" class="mw-redirect" title="Software library">C library</a> is included as part of the <a href="FreeBSD" title="FreeBSD">FreeBSD</a> Unix distribution and is used in the system's <a href="Regression_test" class="mw-redirect" title="Regression test">regression test</a> suite.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Specification">Specification</h2></div>
<p>A formal specification for this protocol exists in the <code>TAP::Spec::Parser</code> and <code>TAP::Parser::Grammar</code> modules. The behavior of the <code>Test::Harness</code> module is the de facto TAP standard implementation, along with a writeup of the specification on TestAnything.org.<sup id="cite_ref-TestAnything.org_4-2" class="reference"><a href="#cite_note-TestAnything.org-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>A project to produce an <a href="IETF" class="mw-redirect" title="IETF">IETF</a> standard for TAP was initiated in August 2008, at <a href="YAPC" class="mw-redirect" title="YAPC">YAPC</a>::Europe 2008.<sup id="cite_ref-TestAnything.org_4-3" class="reference"><a href="#cite_note-TestAnything.org-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div>
<p>Here's an example of TAP's general format:
</p>
<div class="mw-highlight mw-highlight-lang-tap mw-content-ltr" dir="ltr"><pre><span class="kd">1..48</span>
<span class="kr">ok</span> <span class="mi">1</span> Description <span class="c"># Directive</span>
<span class="c"># Diagnostic</span>
....
<span class="kr">ok</span> <span class="mi">47</span> Description
<span class="kr">ok</span> <span class="mi">48</span> Description
</pre></div>
<p>For example, a test file's output might look like:
</p>
<div class="mw-highlight mw-highlight-lang-tap mw-content-ltr" dir="ltr"><pre><span class="kd">1..4</span>
<span class="kr">ok</span> <span class="mi">1</span> - Input file opened
<span class="gr">not ok</span> <span class="mi">2</span> - First line of the input valid.
More output from test 2. There can be
arbitrary number of lines for any output
so long as there is at least some kind
of whitespace at beginning of line.
<span class="kr">ok</span> <span class="mi">3</span> - Read the rest of the file
<span class="c">#TAP meta information</span>
<span class="gr">not ok</span> <span class="mi">4</span> - Summarized correctly <span class="c"># </span><span class="cp">TODO</span><span class="c">: not written yet</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="XUnit" title="XUnit">xUnit</a>&nbsp;– Class of similar unit testing frameworks</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://nnc3.com/mags/LM10/Magazine/Archive/2005/61/076-080_perl/article.html">"A Perl toolbox for regression tests&nbsp;: Testing Tools"</a>. <i>Nnc3.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">27 October</span> 2017</span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite id="CITEREFSchilli" class="citation web cs1">Schilli, Mike. <a rel="nofollow" class="external text" href="http://www.linux-magazine.com/Issues/2016/187/Perl-Print-Test">"Print as Print Can&nbsp;» Linux Magazine"</a>. <i><a href="Linux_Magazine" title="Linux Magazine">Linux Magazine</a></i><span class="reference-accessdate">. Retrieved <span class="nowrap">27 October</span> 2017</span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFSzabo" class="citation web cs1">Szabo, Gabor. <a rel="nofollow" class="external text" href="https://perlmaven.com/tap-test-anything-protocol">"TAP - Test Anything Protocol"</a>. <i>Perl Maven</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-07</span></span>.</cite></span>
</li>
<li id="cite_note-TestAnything.org-4"><span class="mw-cite-backlink">^ <a href="#cite_ref-TestAnything.org_4-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-TestAnything.org_4-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-TestAnything.org_4-2"><sup><i><b>c</b></i></sup></a> <a href="#cite_ref-TestAnything.org_4-3"><sup><i><b>d</b></i></sup></a></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.testanything.org/">"The Test Anything Protocol website"</a>. <i>TestAnything</i><span class="reference-accessdate">. Retrieved <span class="nowrap">February 17,</span> 2025</span>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite id="CITEREFMcClive2017" class="citation web cs1">McClive, Simon (2017-09-21). <a rel="nofollow" class="external text" href="https://medium.com/engineering-on-the-incline/unit-testing-postgres-with-pgtap-af09ec42795">"Unit testing Postgres with pgTAP"</a>. <i><a href="Medium_(website)" title="Medium (website)">Medium</a></i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-07</span></span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite id="CITEREFGravelle2012" class="citation web cs1">Gravelle, Rob (2012-08-13). <a rel="nofollow" class="external text" href="https://www.databasejournal.com/features/mysql/testing-your-mysql-stored-procedures-with-mytap.html">"Testing Your MySQL Stored Procedures with MyTAP"</a>. <i>Database Journal</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-07</span></span>.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://node-tap.org/">"Node Tap"</a>. <i>Node Tap</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-07</span></span>.</cite></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.freebsd.org/cgi/man.cgi?query=tap&amp;sektion=3">"TAP(3) manual page"</a>. <i><a href="FreeBSD" title="FreeBSD">FreeBSD</a></i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-08-07</span></span>.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><span class="official-website"><span class="url"><a rel="nofollow" class="external text" href="https://testanything.org/">Official website</a></span></span> </li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-02-17" href="https://en.wikipedia.org/wiki/?title=Test_Anything_Protocol&amp;oldid=1276242990">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>